<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
	<xsl:attribute-set name="textblock">
		<xsl:attribute name="font-family">Arial</xsl:attribute>
		<xsl:attribute name="font-size">9pt</xsl:attribute>
	</xsl:attribute-set>
	<xsl:attribute-set name="title">
		<xsl:attribute name="font-family">Arial</xsl:attribute>
		<xsl:attribute name="font-size">18pt</xsl:attribute>
		<xsl:attribute name="font-weight">bold</xsl:attribute>
		<xsl:attribute name="text-align">center</xsl:attribute>	
		<xsl:attribute name="margin-bottom">10px</xsl:attribute>	
	</xsl:attribute-set>
	<xsl:attribute-set name="headerText">
		<xsl:attribute name="font-family">Arial</xsl:attribute>
		<xsl:attribute name="font-size">9pt</xsl:attribute>
		<xsl:attribute name="font-weight">bold</xsl:attribute>
	</xsl:attribute-set>
	<xsl:attribute-set name="headerCell">
		<xsl:attribute name="font-family">Arial</xsl:attribute>
		<xsl:attribute name="font-size">9pt</xsl:attribute>
		<xsl:attribute name="font-weight">bold</xsl:attribute>
		<xsl:attribute name="padding">2pt</xsl:attribute>
		<xsl:attribute name="border">0.5pt solid black</xsl:attribute>
		<xsl:attribute name="background-color">gray</xsl:attribute>		
		<xsl:attribute name="text-align">center</xsl:attribute>		
	</xsl:attribute-set>
	<xsl:attribute-set name="pageNumber">
		<xsl:attribute name="font-family">Arial</xsl:attribute>
		<xsl:attribute name="font-size">10pt</xsl:attribute>
	</xsl:attribute-set>
	<xsl:param name="showFOB"><xsl:value-of select="//bulkorders/showfob" /></xsl:param>

	<xsl:template match="/">
		<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
			<!-- defines the layout master -->
			<fo:layout-master-set>
				<fo:simple-page-master master-name="first" page-height="21cm" page-width="29.7cm" margin-top="1cm" margin-bottom="5mm"
					margin-left="1cm" margin-right="1cm">
					<fo:region-body  margin-top="0cm" margin-bottom="1cm" />
					<fo:region-before extent="0cm" />
					<fo:region-after extent="5mm" />
				</fo:simple-page-master>
			</fo:layout-master-set>
			<!-- starts actual layout -->
			<fo:page-sequence master-reference="first">
				<fo:static-content flow-name="xsl-region-after">
					<fo:block xsl:use-attribute-sets="pageNumber">Page <fo:page-number /></fo:block>
				</fo:static-content>							
				<fo:flow flow-name="xsl-region-body">
					<fo:block xsl:use-attribute-sets="title">Customer Order Detail Report</fo:block>
					<fo:block xsl:use-attribute-sets="headerText">Company Name: <xsl:value-of select="//bulkorders/companyName" /></fo:block>
					<!-- table start -->
					<fo:table table-layout="fixed" border="0.5pt solid black">
						<fo:table-column column-width="8mm"/>
						<fo:table-column column-width="23mm"/>
						<fo:table-column />
						<fo:table-column column-width="20mm"/>
						<fo:table-column column-width="20mm"/>
						<fo:table-column column-width="25mm" />
						<fo:table-column />
						<fo:table-column column-width="23mm"/>
						<fo:table-column column-width="18mm"/>
						<fo:table-column column-width="20mm"/>
						<fo:table-column column-width="20mm"/>
						<fo:table-body>
							<fo:table-row>
									<fo:table-cell xsl:use-attribute-sets="headerCell"><fo:block xsl:use-attribute-sets="headerText">Item</fo:block></fo:table-cell>
									<fo:table-cell xsl:use-attribute-sets="headerCell"><fo:block xsl:use-attribute-sets="headerText">Product Code</fo:block></fo:table-cell>
									<fo:table-cell xsl:use-attribute-sets="headerCell"><fo:block text-align="left" xsl:use-attribute-sets="headerText">Description</fo:block></fo:table-cell>
									<fo:table-cell xsl:use-attribute-sets="headerCell"><fo:block xsl:use-attribute-sets="headerText">Order Qty</fo:block></fo:table-cell>
									<fo:table-cell xsl:use-attribute-sets="headerCell"><fo:block xsl:use-attribute-sets="headerText">Units</fo:block></fo:table-cell>
									<fo:table-cell xsl:use-attribute-sets="headerCell"><fo:block xsl:use-attribute-sets="headerText">Unit Price</fo:block></fo:table-cell>
									<fo:table-cell xsl:use-attribute-sets="headerCell"><fo:block xsl:use-attribute-sets="headerText">
									Total 
										<xsl:value-of select="//bulkorders/showfob" />
									Price
									</fo:block></fo:table-cell>
									<fo:table-cell xsl:use-attribute-sets="headerCell"><fo:block xsl:use-attribute-sets="headerText">Priority</fo:block></fo:table-cell>
									<fo:table-cell xsl:use-attribute-sets="headerCell"><fo:block text-align="left" xsl:use-attribute-sets="headerText">Note</fo:block></fo:table-cell>
									<fo:table-cell xsl:use-attribute-sets="headerCell"><fo:block xsl:use-attribute-sets="headerText">Weight</fo:block></fo:table-cell>
									<fo:table-cell xsl:use-attribute-sets="headerCell"><fo:block xsl:use-attribute-sets="headerText">Volume</fo:block></fo:table-cell>
								
							</fo:table-row>
							<xsl:for-each select="bulkorders/bulkorder">
								<fo:table-row>
									<fo:table-cell padding="2pt" border="0.5pt solid black"><fo:block xsl:use-attribute-sets="textblock"><xsl:value-of select="./No" /></fo:block></fo:table-cell>
									<fo:table-cell padding="2pt" border="0.5pt solid black"><fo:block xsl:use-attribute-sets="textblock"><xsl:value-of select="./ProductCode" /></fo:block></fo:table-cell>
									<fo:table-cell padding="2pt" border="0.5pt solid black"><fo:block text-align="left" xsl:use-attribute-sets="textblock"><xsl:value-of select="./Description" /></fo:block></fo:table-cell>
									<fo:table-cell padding="2pt" border="0.5pt solid black"><fo:block text-align="center"  xsl:use-attribute-sets="textblock"><xsl:value-of select="./Qty" /></fo:block></fo:table-cell>
									<fo:table-cell padding="2pt" border="0.5pt solid black"><fo:block xsl:use-attribute-sets="textblock"><xsl:value-of select="./UnitSetting" /></fo:block></fo:table-cell>
									<fo:table-cell padding="2pt" border="0.5pt solid black"><fo:block text-align="right" xsl:use-attribute-sets="textblock"><xsl:value-of select="./UnitPrice" /></fo:block></fo:table-cell>
									<fo:table-cell padding="2pt" border="0.5pt solid black"><fo:block text-align="right" xsl:use-attribute-sets="textblock"><xsl:value-of select="./TotalPrice" /></fo:block></fo:table-cell>
									<fo:table-cell padding="2pt" border="0.5pt solid black"><fo:block text-align="left"  xsl:use-attribute-sets="textblock"><xsl:value-of select="./PriorityIndex" /></fo:block></fo:table-cell>
									<fo:table-cell padding="2pt" border="0.5pt solid black"><fo:block text-align="left" xsl:use-attribute-sets="textblock"><xsl:value-of select="./Notes" /></fo:block></fo:table-cell>
									<fo:table-cell padding="2pt" border="0.5pt solid black"><fo:block text-align="right" xsl:use-attribute-sets="textblock"><xsl:value-of select="./UnitWeight" /></fo:block></fo:table-cell>
									<fo:table-cell padding="2pt" border="0.5pt solid black"><fo:block text-align="right" xsl:use-attribute-sets="textblock"><xsl:value-of select="./MinQtyVolume" /></fo:block></fo:table-cell>
								</fo:table-row>
							</xsl:for-each>
						</fo:table-body>
					</fo:table>
					<!-- table end -->
				</fo:flow>
			</fo:page-sequence>
		</fo:root>
	</xsl:template>
</xsl:stylesheet>

